<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单列表')"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            昵称：<input type="text" name="nickNameForSearch"/>
                        </li>
                        <!-- <li>
                            姓名：<input type="text" name="realNameForSearch"/>
                        </li> -->
                        <li>
                            手机号码：<input type="text" name="mobileForSearch"/>
                        </li>
                        <li>
                            收货人姓名：<input type="text" name="addressRealname"/>
                        </li>
                        <li>
                            订单编号：<input type="text" name="orderid"/>
                        </li>


                        <li class="select-selectpicker">
                            <label>订单状态： </label><select name="orderShuxin" class="selectpicker"
                                                         data-none-selected-text="请选择">
                            <option></option>
                            <option value="2001">待付款</option>
                            <option value="2002">待接单</option>
                            <option value="2003">待送达</option>
                            <option value="2004">待确认</option>
                            <option value="2005">已完成</option>
                            <option value="2006">退款</option>
                        </select>
                        </li>

                        <!-- <li>
                            订单属性 待付款2001，待接单2002，待送达2003，待确认2004，已完成2005，退款2006：<input type="text" name="orderShuxin"/>
                        </li> -->


                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="Order:order:remove">
                <i class="fa fa-remove"></i> 删除
            </a>

        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<th:block th:include="include :: bootstrap-select-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('Order:order:edit')}]];
    var removeFlag = [[${@permission.hasPermi('Order:order:remove')}]];
    var prefix = ctx + "Order/outedShoppingOrder";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            detailUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            detailUrl: prefix + "/detail/{id}",
            modalName: "订单",
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'orderid',
                    title: '订单编号',
                    sortable: true
                },
                {
                    title: '订单类型',
                    formatter: function (value, row, index) {
                        if (row.ifJiadan == 1) {
                            return "闪送加单";
                        } else {
                            return row.type;
                        }
                    }
                },

                {
                    field: 'addressId',
                    title: '收件地址',
                    sortable: true
                },
                {
                    field: 'addressRealname',
                    title: '收货人',
                    sortable: true
                },

                {
                    field: 'orderShuxin',
                    title: '订单状态',
                    sortable: true
                },

                {
                    field: 'creactDate',
                    title: '创建时间',
                    sortable: true
                },

                {
                    field: 'jine',
                    title: '总金额',
                    sortable: true
                },


                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="orderUpdate(\'' + row.id + '\')"><i class="fa fa-remove"></i>查看订单</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function orderUpdate(id) {
        $.modal.open('编辑订单', prefix + "/edit/" + id, '1300', '800');
    }

    function orderGoods(id) {
        $.modal.open('订单商品', prefix + "/orderGoods/" + id, '1300', '800');
    }

    function orderUpdate(id) {
        var _url = $.operate.detailUrl(id);
        var options = {
            title: $.table._option.modalName + "详情",
            width: 1300,
            height: 800,
            url: prefix + "/edit/" + id,
            skin: 'layui-layer-gray',
            btn: ['关闭'],
            yes: function (index, layero) {
                layer.close(index);
            }
        };
        $.modal.openOptions(options);
    }

    function orderOut(id) {
        $.modal.confirm("是否确认出库？", function () {
            var url = prefix + "/orderOut";
            var data = {"id": id};
            $.operate.submit(url, "post", "json", data);
        });
    }
</script>
</body>
</html>